package com.bh.ledger.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.common.utils.DateUtils;
import com.bh.ledger.domain.JcSettlement;
import com.bh.ledger.mapper.JcSettlementMapper;
import com.bh.ledger.service.IJcSettlementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 结算总表Service业务层处理
 *
 * @author slx
 * @date 2023-04-24
 */
@Service
public class JcSettlementServiceImpl extends ServiceImpl<JcSettlementMapper, JcSettlement> implements IJcSettlementService {
    @Autowired
    private JcSettlementMapper jcSettlementMapper;

    /**
     * 查询结算总表
     *
     * @param id 结算总表主键
     * @return 结算总表
     */
    @Override
    public JcSettlement selectJcSettlementById(Long id) {
        return jcSettlementMapper.selectById(id);
    }

    /**
     * 查询结算总表列表
     *
     * @param jcSettlement 结算总表
     * @return 结算总表
     */
    @Override
    public List<JcSettlement> selectJcSettlementList(JcSettlement jcSettlement) {
        return jcSettlementMapper.selectJcSettlementList(jcSettlement);
    }

    /**
     * 新增结算总表
     *
     * @param jcSettlement 结算总表
     * @return 结果
     */
    @Override
    public int insertJcSettlement(JcSettlement jcSettlement) {
        jcSettlement.setCreateTime(DateUtils.getNowDate());
        return jcSettlementMapper.insert(jcSettlement);
    }

    /**
     * 修改结算总表
     *
     * @param jcSettlement 结算总表
     * @return 结果
     */
    @Override
    public int updateJcSettlement(JcSettlement jcSettlement) {
        return jcSettlementMapper.updateById(jcSettlement);
    }

    /**
     * 批量删除结算总表
     *
     * @param ids 需要删除的结算总表主键
     * @return 结果
     */
    @Override
    public int deleteJcSettlementByIds(Long[] ids) {
        return jcSettlementMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除结算总表信息
     *
     * @param id 结算总表主键
     * @return 结果
     */
    @Override
    public int deleteJcSettlementById(Long id) {
        return jcSettlementMapper.deleteById(id);
    }
}
